package com.bilibili.api;

import com.bilibili.domain.JsonResponse;
import com.bilibili.service.ElasticSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * projectName:com.bilibili.api
 *
 * @author 飞
 * @create by 2024/7/711:32
 * description:
 */
@Api(tags = "系统接口")
//@RestController
public class SystemController {
    @Resource
    private ElasticSearchService elasticSearchService;

    @GetMapping("contents")
    @ApiOperation("全文搜索")
    public JsonResponse<List<Map<String,Object>>> getContents(@RequestParam String keyword,
                                                              @RequestParam Integer pageNo,
                                                              @RequestParam Integer pageSize) throws Exception {
        List<Map<String, Object>> contents = elasticSearchService.getContents(keyword, pageNo, pageSize);
        return new JsonResponse<>(contents);
    }
}
